package io.renren.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.app.service.BannerPtService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zheok.testing.entity.BannerPtEntity;




/**
 * 平台Banner
 *
 * @author ææ¢
 * @email 2863751700@qq.com
 * @date 2022-08-03 15:38:56
 */
@RestController
@RequestMapping("testing/bannerpt")
public class BannerPtController {
    @Autowired
    private BannerPtService bannerPtService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    ////@RequiresPermissions("testing:bannerpt:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bannerPtService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    ////@RequiresPermissions("testing:bannerpt:info")
    public R info(@PathVariable("id") Long id){
		BannerPtEntity bannerPt = bannerPtService.getById(id);

        return R.ok().put("bannerPt", bannerPt);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    ////@RequiresPermissions("testing:bannerpt:save")
    public R save(@RequestBody BannerPtEntity bannerPt){
		bannerPtService.save(bannerPt);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    ////@RequiresPermissions("testing:bannerpt:update")
    public R update(@RequestBody BannerPtEntity bannerPt){
		bannerPtService.updateById(bannerPt);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    ////@RequiresPermissions("testing:bannerpt:delete")
    public R delete(@RequestBody Long[] ids){
		bannerPtService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
